package api.ks;


import androidx.fragment.app.Fragment;
import java.lang.ref.SoftReference;

public abstract class ContentPage_API_KS {

   public static String clazz = "com.dotools.kslibrary.KS_ContentPage";

    private static SoftReference<ContentPage_API_KS> sf;

    public synchronized static ContentPage_API_KS getInstance() {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<>((ContentPage_API_KS) o);
                return (ContentPage_API_KS) o;
            }
        }
        return sf == null ? null : sf.get();
    }

    public abstract void loadContentPage( long adposid,PageListener pageListener, VideoPlayListener videoListener);

    public abstract Fragment getFragment();

    public interface PageListener {
        void onPageEnter(int position);
        void onPageResume(int position);
        void onPagePause(int position);
        void onPageLeave(int position);
    }


    public interface VideoPlayListener {
        void onVideoPlayStart(int position);

        void onVideoPlayPaused(int position);

        void onVideoPlayResume(int position);

        void onVideoPlayCompleted(int position);

        void onVideoPlayError(int position);
    }
}
